import HttpRequest from "@/utils/request";
import { IRows, IDept } from "./type";

// 获取部门
export function getDepartments(params = {}) {
  return HttpRequest<IRows>("/department", "GET", params, {
    isLoading: true,
  });
}

// 获取某条
export function getDepartment(id: number) {
  return HttpRequest<IDept>("/department/" + id, "GET");
}
// 新增
export function addDepartment(params: any = {}) {
  return HttpRequest("/department", "POST", params);
}

// 修改
export function updateDepartment(params: any = {}) {
  return HttpRequest("/department", "PUT", params);
}

// 删除
export function delDepartment(ids: string[] = []) {
  return HttpRequest("/department", "DELETE", { ids: ids.join() });
}
